﻿using System;
using System.Text;
using System.Drawing;
using System.Buffers;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;

public static partial class NativeAOT
{
    [UnmanagedCallersOnly(EntryPoint = "student")]
    public static unsafe double student_dll(double t, int n)
    {
        return student(t, n);
    }

    /// <summary>
    /// t_分布函数
    /// </summary>
    /// <param name="t">t随机变量值。要求t>=0。</param>
    /// <param name="n">自由度。</param>
    /// <returns>返回t分布函数值。</returns>
    public static unsafe double student(double t, int n)
    {
        double y;
        if (t < 0.0) t = -t;
        y = 1.0 - inbeta(n / 2.0, 0.5, n / (n + t * t));
        return (y);
    }

    /*
    // t_分布函数例
      int main()
      { 
          int n;
          double t,y;
          for (n=1; n<=5; n++)
          { 
              t=0.5; y=student(t,n);
              cout <<"P(" <<t <<", " <<n <<")=" <<y <<endl;
              t=5.0; y=student(t,n);
              cout <<"P(" <<t <<", " <<n <<")=" <<y <<endl;
          }
          return 0;
      }
    */
}

